import request from './request'

// 获取指定ID的饮食记录
export const getDietRecordApi = id => request.get(`/diet-records/${id}`)

// 获取当前用户的饮食记录列表
export const getCurrentUserDietRecordsApi = () => request.get('/diet-records/current')

// 创建饮食记录
export const createDietRecordApi = data => request.post('/diet-records', data)

// 更新饮食记录
export const updateDietRecordApi = (id, data) => request.put(`/diet-records/${id}`, data)

// 删除饮食记录
export const deleteDietRecordApi = id => request.delete(`/diet-records/${id}`)

// 根据日期范围获取饮食记录
export const getDietRecordsByDateRangeApi = (startDate, endDate) => request.get('/diet-records/date-range', {
    params: { startDate, endDate }
})

// 根据餐食类型和日期获取记录
export const getDietRecordsByMealTypeApi = (mealType, date) => request.get('/diet-records/meal-type', {
    params: { mealType, date }
})

// 获取每日营养总结
export const getDailyNutritionSummaryApi = date => request.get('/diet-records/daily-summary', {
    params: { date }
})

// 获取每周营养趋势
export const getWeeklyNutritionTrendApi = (startDate, endDate) => request.get('/diet-records/weekly-trend', {
    params: { startDate, endDate }
}) 